<script setup>
import useSettingsStore from '@/stores/modules/settings';

const settingsStore = useSettingsStore();
import {useRouter} from "vue-router";
import {eventBus} from "@/utils/eventBus.js";

// 说明：keepAlive 为 true，标志着他为tabbar页面，如主页、我的...
// keepAlive 为 false，标志着他为非tabbar页面，如个人资料页、搜索页...

let router = useRouter();
const onClickRight = () => {
  eventBus.emit('nav-right-click');
};

</script>
<template>
  <template v-if="$route.meta.showNav">
    <van-nav-bar
        v-if="$route.meta.rightText"
        placeholder
        fixed
        :title="settingsStore.title"
        :left-arrow="!$route.meta.keepAlive"
        @click-left="$router.back()"
        :right-text="$route.meta.rightText"
        @click-right="onClickRight"
    />
    <van-nav-bar
        v-else
        placeholder
        fixed
        :title="settingsStore.title"
        :left-arrow="!$route.meta.keepAlive"
        @click-left="$router.back()"/>
  </template>
</template>
<style lang="scss" scoped></style>
